package com.dtagri.fjwlw.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;

import com.dtagri.fjwlw.R;
import com.dtagri.fjwlw.widget.EmptyLayout;

/**
 * 与BaseSimpleFragment配合使用，处理网络异常，缓存等与业务无关的事
 * 
 * @author wxjn
 * 
 */
public abstract class BaseSimpleActivity extends BaseActivity {
	public EmptyLayout getmErrorLayout() {
		return mErrorLayout;
	}

	protected EmptyLayout mErrorLayout;

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	protected int getLayoutId() {
		return R.layout.layout_common_base;
	}

	@Override
	protected void init(Bundle savedInstanceState) {
		super.init(savedInstanceState);
		if (getFragment() != null) {
			if (savedInstanceState == null) {
				getSupportFragmentManager().beginTransaction()
						.add(R.id.container, getFragment()).commit();
			}
		}
	}

	@Override
	protected boolean hasBackButton() {
		return true;
	}

	protected abstract Fragment getFragment();

	@Override
	public void initView() {
		mErrorLayout = (EmptyLayout) findViewById(R.id.error_layout);
		mErrorLayout.setErrorType(EmptyLayout.NODATA);
	}

	@Override
	public void initData() {
		// TODO Auto-generated method stub

	}

}
